package com.dkm.ec.so.repository.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.xalan.templates.ElemWhen;
import org.springframework.stereotype.Repository;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.db.persistence.dao.IQueryDao;
import com.dkm.biz.repository.AbstractRepository;
import com.dkm.ec.so.domain.ShipBill;
import com.dkm.ec.so.repository.ShipBillRepository;
import com.dkm.ec.so.persistence.dao.ShipBillQueryDao;
import com.dkm.ec.so.persistence.entity.ShipBillPo;

/**
 * 对象功能:发货单 Repository接口的实现类
 * 开发公司:dkm.com
 * 开发人员:ZHH
 * 创建时间:2017-05-24 16:25:01
 */
@Repository
public class ShipBillRepositoryImpl extends AbstractRepository<String, ShipBillPo,ShipBill> implements ShipBillRepository{
	  
	@Resource
	private  ShipBillQueryDao shipBillQueryDao;

	public ShipBill newInstance() {
		ShipBillPo po = new ShipBillPo();
		ShipBill shipBill = SpringHelper.getBean(ShipBill.class);
		shipBill.setData(po);
		return shipBill;
	}

	public ShipBill newInstance(ShipBillPo po) {
		ShipBill shipBill = SpringHelper.getBean(ShipBill.class);
		shipBill.setData(po);
		return shipBill;
	} 
	
	@Override
	protected IQueryDao<String, ShipBillPo> getQueryDao() {
		return shipBillQueryDao;
	}

	@Override
	public List<ShipBillPo> findByEntityId(String key) {
	     Map<String, Object> params = new HashMap<String, Object>();
		 params.put("whereSql", "so_entity_id_='"+key+"'");
	     List<ShipBillPo> shipBillPos = findAll(params);
		 return shipBillPos;
	}
	
}
